#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2020/12/15 14:27
# @Author  : LuLu
# @FileName: tourguideLocators.py
# @Software: PyCharm


from selenium.webdriver.common.by import By


class TourguideLocators(object):
    # TODO 完善攻略元素

    """
    攻略列表页面
    """
    # 搜索
    search_button = (By.XPATH, '//*[@id="search-btn"]')
    # 清空条件
    clean_button = (By.XPATH, '//*[@id="search-clean-btn"]')
    # 新增攻略
    add_TourGuide_button = (By.XPATH, '//*[@id="etravel"]/div/div[3]/div/div[2]/div[3]/button[1]')
    # 置顶
    top_button = (By.XPATH, '//*[@id="etravel"]/div/div[3]/div/div[2]/div[3]/button[2]')
    # 取消置顶
    cancel_top_button = (By.XPATH, '//*[@id="etravel"]/div/div[3]/div/div[2]/div[3]/button[3]')

    # TODO 未处理的操作
    # 编辑
    edit_button = (By.XPATH, '//*[@id="etravel"]/div/div[3]/div/div[2]/div[5]/div[1]/div[2]/div[2]/table/tbody/tr['
                             '1]/td[14]/a[1]')

    # TAB信息
    @staticmethod
    def Tab_button(num=1):
        return By.XPATH, f'//*[@id="etravel"]/div/div[3]/div/div[2]/div[1]/div[{num}]'

    """
    在线编辑器
    """
    # 编辑器上传弹层
    editor_upload_iframe = (By.XPATH, '//*[@class="%%-iframe"]')
    # 编辑器右上角图片上传功能按钮
    editor_upload_button = (By.XPATH, '//*[starts-with(@id,"edui")][@title="多图上传"]')
    # 编辑器首次上传
    editor_upload_pic_button_first = (By.XPATH, '//*[@id="filePickerReady"]')
    # 编辑器再次上传顶部按钮
    editor_upload_pic_button_continue_top = (By.XPATH, '//*[@id="filePickerBtn"]')
    # 编辑器再次上传右侧按钮
    editor_upload_pic_button_continue_right = (By.XPATH, '//*[@id="filePickerBlock"]')
    # 编辑器开始上传
    editor_start_upload = (By.XPATH, '//*[@id="queueList"]/div[1]/div[3]/div[2]')
    # 编辑器关闭按钮
    editor_close_button = (By.XPATH, '//*[starts-with(@id,"edui")]'
                                     '[@class="edui-box edui-button edui-cancelbutton edui-default"]')
    # 编辑器已选中图片列表
    editor_selected_pic_list = (By.XPATH, '//*[@id="queueList"]/ul')

    # 编辑器单个已选中图片
    @staticmethod
    def editor_selected_pic_img(num=0):
        return By.XPATH, f'//*[starts-with(@id,"WU_FILE_{num}")]/p[2]/img'
